#include "template.h"

USE_LOGGER(DEV);

static int _init(void *config)
{
    LogDebug("template %s start\r\n",__FUNCTION__);
    return 0;
}

static uint32_t _read(uint32_t address, void *buffer, uint32_t size, void *opt)
{
    LogDebug("template %s start\r\n",__FUNCTION__);
    return 0;
}

static uint32_t _write(uint32_t address, void *buffer, uint32_t size, void *opt)
{
    LogDebug("template %s start\r\n",__FUNCTION__);
    return 0;
}

static int _ioctl(int cmd, void *arg)
{
    LogDebug("template %s start\r\n",__FUNCTION__);
    return 1;
}

static int _writeable(void)
{
    LogDebug("template %s start\r\n",__FUNCTION__);
    return 1;
}

static int _readable(void)
{
    LogDebug("template %s start\r\n",__FUNCTION__);
    return 1;
}

static void _flush(void)
{
    LogDebug("template %s start\r\n",__FUNCTION__);
}

static TEMPLATE _template =
{
    .init = _init,
    .ioctl = _ioctl,
    .read = _read,
    .write = _write,
    .readable = _readable,
    .writeable = _writeable,
    .flush = _flush
};

#define __MODULE_NAME       ("template")
static void _template_init(void)
{
    LogDebug("%s start\r\n",__FUNCTION__);
    if(dev_register(__MODULE_NAME, (void *)&_template) > 0)
    {
        LogInfo("%s ---> ok\r\n",__MODULE_NAME);
    }
}
MODULE_INIT(_template_init);
